<%@ page import="com.yinhai.core.common.api.config.impl.SysConfig"%>
<%@ page language="java" pageEncoding="UTF-8"%>
<jsp:directive.page import="java.util.Date" />
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<%@ taglib prefix="ta" tagdir="/WEB-INF/tags/tatags"%>

<html xmlns="http://www.w3.org/1999/xhtml" style="height:100%">
<head>
<title>电子邮件配置</title>
</head>
<%@ include file="/ta/inc.jsp"%>
<body >
	<ta:pageloading />
	<ta:box minWidth="1000" fit="true" cssStyle="margin-top:5px">
		<ta:panel id="pnlEmailQry" key="查询条件" cols="3" >
			<ta:text id="qry_emailAddress" key="邮箱账号" />
			<ta:text id="qry_systemName" key="接入系统名称" />
			<ta:buttonLayout>
				<ta:button id="qry" isok="true" key="查询" onClick="fnQuery()" />
				<ta:button id="clear" key="清空" onClick="fnClear()" />
			</ta:buttonLayout>
		</ta:panel>
		<ta:panel id="pnlEmailInfo" key="账号信息" withToolBar="true" fit="true" >
			<ta:panelToolBar>
				<ta:button id="btnAdd" key="新增[A]" hotKey="a" icon="icon-add" isShowIcon="true" asToolBarItem="true" onClick="fnAdd();" />
			</ta:panelToolBar>
			<ta:datagrid id="MainGrid" fit="true" haveSn="true" clickActiveStyle="true" forceFitColumns="true" columnFilter="true" >
				<ta:datagridItem id="emailAddress" key="邮箱账号"  sortable="true"/>
				<ta:datagridItem id="defaultemail" key="默认邮箱" width="50px" collection="YESORNO" sortable="true" />
				<ta:datagridItem id="sendHost" key="发送服务器主机名"  sortable="true"/>
				<ta:datagridItem id="sendPort" key="端口" width="50px" />
				<ta:datagridItem id="isSendSSL" key="SSL" width="50px" collection="YESORNO" />
				<ta:datagridItem id="isSendTLS" key="TLS" width="50px" collection="YESORNO" />
				<ta:datagridItem id="timeout" key="超时时间" width="50px" />
				<ta:datagridItem id="systemId" key="接入系统id" />
				<ta:datagridItem id="systemName" key="接入系统名称" />
				<ta:datagridItemOperate id="a" showAll="false" name="操作">
					<ta:datagridItemOperateMenu icon="a" name="编辑" click="fnUpdate" />
					<ta:datagridItemOperateMenu icon="a" name="删除" click="fnDelete" />
				</ta:datagridItemOperate>
				<ta:dataGridToolPaging url="EmailConfigController!pageQueryEmailConfig.do" pageSize="10" submitIds="MainGrid" showButton="true" showCount="true"  />
			</ta:datagrid>
		</ta:panel>
	</ta:box>
</body>
</html>
<script type="text/javascript">
	$(document).ready(function() {
		$("body").taLayout();
		fnQuery();
	});
	/*模糊查询*/
	function fnQuery(){
		Base.clearGridDirty("MainGrid");
		Base.submit("pnlEmailQry,MainGrid","EmailConfigController!pageQueryEmailConfig.do");
	}
	
	/*增加邮箱账户页面*/
	function fnAdd(){
		Base.openWindow("addconfig","添加邮箱","EmailConfigController!toAddEmailConfig.do",null, 650, 550,  null,fnQuery(),true);
	}
	
	/*打开修改页面*/
	function fnUpdate(rowdata){
		Base.openWindow("editconfig","编辑邮箱","EmailConfigController!toEditEmailConfig.do",{"dto['emailAddress']":rowdata.emailAddress}, 650,550,null,fnQuery(),true);
		Base.setEnable("btn_save,btn_cancel");
	}
	
	/* 删除按钮点击事件 */
	function fnDelete(rowdata){
		Base.confirm("确定删除此邮箱账户吗?",function(yes){
			if(yes){
				Base.submit("pnlEmailQry,MainGrid","EmailConfigController!deleteEmailInfo.do",{"dto['emailAddress']":rowdata.emailAddress},null,null,function(){
					fnQuery();
					Base.msgTopTip("删除成功!");
				},null);
			}
		}); 
	}
	
	/*清空查询条件  */
	function fnClear(){
		Base.setValue("qry_emailAddress","");
		Base.setValue("qry_systemName","");
	}
	
</script>
<%@ include file="/ta/incfooter.jsp"%>